let arr = new Array(10000000)

// Object唯一
function deDuplicateByObj(arr) {
    let result = []
    let obj = {}
    for (let i of arr) {
        if (!obj[i]) {
            result.push(i)
            obj[i] = 1
        }
    }
    return result
}

// set
function deDuplicate(arr){
    return [...new Set(arr)]
}

let begin = new Date().getMilliseconds()
deDuplicate(arr)
let end = new Date().getMilliseconds()
console.log(end-begin+'ms');

begin = new Date().getMilliseconds()
deDuplicateByObj(arr)
end = new Date().getMilliseconds()
console.log(end-begin+'ms');
